Skip to content

Bugfix of baseline_chars (missing comma)#87

Merged
pelson merged 4 commits intoipython:masterfrom
dummy-index:fix/baseline_chars
May 4, 2026
Merged

Bugfix of baseline_chars (missing comma)#87
pelson merged 4 commits intoipython:masterfrom
dummy-index:fix/baseline_chars

Conversation

@dummy-index
Copy link
Copy Markdown
Contributor

@dummy-index dummy-index commented May 2, 2026

Fixes #67.
['a' 'e', ...] was interpreted as ['ae', ...] and did not match a and e.

With this fix, the recognition of the baseline is improved, and the variation within _spans is also reduced. As a result, c and s get closer to the baseline, and their positions at low DPI are improved.

(Kerning is fluctuating, but it will be fixed in a separate PR.fixed.)

@pelson pelson force-pushed the fix/baseline_chars branch from c816b95 to 447f06d Compare May 3, 2026 04:22
@dummy-index
Copy link
Copy Markdown
Contributor Author

Generated files differ from committed files.
Download the 'xkcd-script-font' artifact from this run and commit the updated files.

I downloaded it, extracted the zip, and did a diff between the PNGs, but there is no difference...

Copy link
Copy Markdown
Member

@pelson pelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Kerning is fluctuating, but it will be fixed in a separate PR.fixed.)

Now that I look deeper, I note that if we're auto-kerning all the letters then we should just go straight to fix the bounding box of the character itself, and leave kerning for specific pairs...

I have a few changes after this one that I'll propose in a PR.



baseline_chars = ['a' 'e', 'm', 'A', 'E', 'M', '&', '@', '.', u'≪', u'É']
baseline_chars = ['a', 'e', 'm', 'A', 'E', 'M', '&', '@', '.', u'≪', u'É']
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One little character missing has quite the effect... !

@pelson pelson force-pushed the fix/baseline_chars branch from b3b82bf to 5634378 Compare May 4, 2026 02:37
@pelson pelson force-pushed the fix/baseline_chars branch from 5634378 to d7ea880 Compare May 4, 2026 02:44
fig = render_block(label, rows)
out = os.path.join(OUTDIR, f'charmap_{slugify(label)}.png')
fig.savefig(out, dpi=150, bbox_inches='tight', facecolor=fig.get_facecolor())
Image.open(out).save(out)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously there was the matplotlib version in the metadata, which was a source of non-reproducible output (the version changed recently). Here, I drop that metadata.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A definite improvement! 👍

@pelson pelson merged commit 562a101 into ipython:master May 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bigraph "cc" looks unnatural

2 participants